core: Drop ot_clear_hashtable for g_clear_pointer()
authorColin Walters <walters@verbum.org>
Tue, 17 Jul 2012 12:18:43 +0000 (08:18 -0400)
committerColin Walters <walters@verbum.org>
Tue, 17 Jul 2012 12:18:43 +0000 (08:18 -0400)
src/libotutil/ot-variant-utils.h
src/ostree/ostree-pull.c
src/ostree/ot-builtin-fsck.c

index ea238b402d91558b331b520797ca6e593cd84483..1dec5c4704a23fddea3930f4f3c201203dea391c 100644 (file)
 
 G_BEGIN_DECLS
 
-#define ot_clear_hashtable(a_v) do { \
-  if (*a_v)                         \
-    g_hash_table_unref (*a_v);         \
-  *a_v = NULL;                      \
-  } while (0);
-
 GVariant *ot_gvariant_new_bytearray (const guchar   *data,
                                      gsize           len);
 
index dde4f0ac7a9ba2a4ea4b2790c167dfe50f64f411..d1cc5ee3ebfb2a2e3a797ad0ef3b8be232d2a655 100644 (file)
@@ -1660,7 +1660,7 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
   g_free (pull_data->remote_name);
   if (pull_data->base_uri)
     soup_uri_free (pull_data->base_uri);
-  ot_clear_hashtable (&pull_data->file_checksums_to_fetch);
+  g_clear_pointer (&pull_data->file_checksums_to_fetch, (GDestroyNotify) g_hash_table_unref);
   g_clear_pointer (&pull_data->cached_meta_pack_indexes, (GDestroyNotify) g_ptr_array_unref);
   g_clear_pointer (&pull_data->cached_data_pack_indexes, (GDestroyNotify) g_ptr_array_unref);
   if (summary_uri)
index bfb78b99a3c32557fb65aca54be67581852aab52..1a003623cff298b621d9ceda979b961695f1c646 100644 (file)
@@ -347,7 +347,7 @@ ostree_builtin_fsck (int argc, char **argv, GFile *repo_path, GError **error)
         g_hash_table_insert (commits, g_variant_ref (serialized_key), serialized_key);
     }
 
-  ot_clear_hashtable (&objects);
+  g_clear_pointer (&objects, (GDestroyNotify) g_hash_table_unref);
 
   g_print ("Verifying content integrity of %u commit objects...\n",
            (guint)g_hash_table_size (commits));